package com.hongxun.entity;

import android.graphics.Rect;
import android.os.Parcel;
import android.support.annotation.Nullable;

import com.previewlibrary.enitity.IThumbViewInfo;

/**
 * Created by admin on 2017/12/22.
 */

public class ImageUrl implements IThumbViewInfo {

    private String url;
    private Rect rect;

    public ImageUrl(String url, Rect rect){
        this.url=url;
        this.rect=rect;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Override
    public String getUrl() {
        return url;
    }

    @Override
    public Rect getBounds() {
        return rect;
    }

    @Nullable
    @Override
    public String getVideoUrl() {
        return null;
    }

    public void setBounds(Rect rect) {
        this.rect = rect;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.url);
        dest.writeParcelable(this.rect, flags);
    }

    public ImageUrl() {
    }

    protected ImageUrl(Parcel in) {
        this.url = in.readString();
        this.rect = in.readParcelable(Rect.class.getClassLoader());
    }

    public static final Creator<ImageUrl> CREATOR = new Creator<ImageUrl>() {
        @Override
        public ImageUrl createFromParcel(Parcel source) {
            return new ImageUrl(source);
        }

        @Override
        public ImageUrl[] newArray(int size) {
            return new ImageUrl[size];
        }
    };
}
